import request from '@/utils/request'

const defaultParams = {
  offset: 0,
  limit: 20
}
export function xhrGetRoleOptions(params = defaultParams) {
  return request({
    url: '/role/roleOptions',
    method: 'get',
    params
  })
}

export function xhrGetAccountList(params = defaultParams) {
  return request({
    url: '/userInfo/userList',
    method: 'get',
    params
  })
}

export function xhrGetRoleList(params = defaultParams) {
  return request({
    url: '/role/roleList',
    method: 'get',
    params
  })
}


export function xhrDelAccount(data = {}) {
  return request({
    url: '/userInfo/userDel',
    method: 'post',
    data
  })
}

export function xhrResetAccoutPwd(params = {}) {
  return request({
    url: '/userInfo/resetPassword',
    method: 'get',
    params
  })
}

export function xhrAddAccount(data = {}) {
  return request({
    url: '/userInfo/userAdd',
    method: 'post',
    data
  })
}

export function xhrEditAccount(data = {}) {
  return request({
    url: '/userInfo/userUpdate',
    method: 'post',
    data
  })
}

export function xhrGetPermissionList(params = {}) {
  return request({
    url: '/permission/permissionList',
    method: 'get',
    params
  })
}
export function xhrDelRole(data = {}) {
  return request({
    url: '/role/roleDel',
    method: 'post',
    data
  })
}
export function xhrAddRole(data = {}) {
  return request({
    url: '/role/roleAdd',
    method: 'post',
    data
  })
}

export function xhrEditRole(data = {}) {
  return request({
    url: '/role/roleUpdate',
    method: 'post',
    data
  })
}

export function xhrGetMenus(params = {}) {
  return request({
    url: '/permission/menuList',
    method: 'get',
    params
  })
}

export function xhrSysLog(params = {}) {
  return request({
    url: '/sysLog/logList',
    method: 'get',
    params
  })
}

export function userInfo() {
  return request({
    url: '/userInfo',
    method: 'get'
  })
}
